import requests

import config

class LoginAPI:
    def __init__(self):
        self.url_Verification_code=config.BASE_URL +  "/api/captchaImage"
        self.url_login = config.BASE_URL + "/api/login"

    def get_Verification_code(self):
        return requests.get(url=self.url_Verification_code)

    def login(self,login_data):
        return requests.post(url=self.url_login,json=login_data)

if __name__ == '__main__':
    loginapi=LoginAPI()
    response = loginapi.get_Verification_code()
    uuid = response.json().get("uuid")
    login_data={
            "username": "admin",
            "password": "admin123",
            "code": "2",
            "uuid": uuid
        }
    response = loginapi.login(login_data)
    print(response.json())
